<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Maven 依赖管理完全指南</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        /* 首字下沉效果 */
        .drop-cap::first-letter {
            float: left;
            font-size: 4rem;
            line-height: 3rem;
            padding-right: 0.5rem;
            margin-top: 0.5rem;
            font-weight: 700;
            color: #4f46e5;
            font-family: 'Noto Serif SC', serif;
        }
        
        /* 代码块美化 */
        pre {
            background: #1e293b;
            color: #e2e8f0;
            border-radius: 12px;
            padding: 1.5rem;
            overflow-x: auto;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
            position: relative;
            margin: 1.5rem 0;
        }
        
        pre::before {
            content: attr(data-language);
            position: absolute;
            top: 0.5rem;
            right: 1rem;
            font-size: 0.75rem;
            color: #64748b;
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }
        
        /* 卡片悬停效果 */
        .hover-card {
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }
        
        .hover-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
        }
        
        /* 渐变文字效果 */
        .gradient-text {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        /* 章节编号样式 */
        .section-number {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 2.5rem;
            height: 2.5rem;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-radius: 50%;
            font-weight: 700;
            margin-right: 1rem;
            flex-shrink: 0;
        }
        
        /* 引用块样式 */
        .quote-block {
            border-left: 4px solid #4f46e5;
            padding-left: 1.5rem;
            margin: 1.5rem 0;
            font-style: italic;
            color: #475569;
        }
        
        /* 滚动指示器 */
        #scroll-indicator {
            position: fixed;
            top: 0;
            left: 0;
            height: 4px;
            background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 100%);
            z-index: 100;
            transition: width 0.2s ease;
        }
        
        /* Mermaid 图表样式 */
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
    </style>
</head>
<body>
    <!-- 滚动进度指示器 -->
    <div id="scroll-indicator" style="width: 0%"></div>
    
    <!-- Hero 区域 -->
    <section class="relative overflow-hidden bg-gradient-to-br from-indigo-600 via-purple-600 to-pink-500 text-white">
        <div class="absolute inset-0 bg-black opacity-20"></div>
        <div class="relative container mx-auto px-6 py-24 text-center">
            <h1 class="text-5xl md:text-7xl font-bold mb-6 animate-pulse">
                Maven 依赖管理
                <span class="block text-3xl md:text-4xl mt-4 font-light">完全指南</span>
            </h1>
            <p class="text-xl md:text-2xl mb-8 max-w-3xl mx-auto opacity-90">
                解决版本冲突、下载失败、构建异常的终极方案
            </p>
            <div class="flex justify-center space-x-6 text-sm">
                <div class="flex items-center">
                    <i class="fas fa-clock mr-2"></i>
                    <span>阅读时间：15分钟</span>
                </div>
                <div class="flex items-center">
                    <i class="fas fa-tag mr-2"></i>
                    <span>Java · Maven · 构建工具</span>
                </div>
            </div>
        </div>
        <div class="absolute bottom-0 left-0 right-0">
            <svg viewBox="0 0 1440 120" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path d="M0 120L60 105C120 90 240 60 360 45C480 30 600 30 720 37.5C840 45 960 60 1080 67.5C1200 75 1320 75 1380 75L1440 75V120H1380C1320 120 1200 120 1080 120C960 120 840 120 720 120C600 120 480 120 360 120C240 120 120 120 60 120H0Z" fill="white"/>
            </svg>
        </div>
    </section>
    
    <!-- 主要内容区域 -->
    <main class="container mx-auto px-6 py-12 max-w-5xl">
        <!-- 引言 -->
        <div class="bg-white rounded-2xl shadow-xl p-8 mb-12 hover-card">
            <p class="text-lg leading-relaxed text-gray-700 drop-cap">
                Maven 作为 Java 生态中最流行的构建工具之一，极大地简化了项目的依赖管理和构建流程。然而，在实际使用中，开发者经常会遇到依赖冲突、下载失败、构建异常等问题。这些问题不仅影响开发效率，还可能导致项目无法正常运行。
            </p>
        </div>
        
        <!-- 问题概览卡片 -->
        <div class="grid md:grid-cols-3 gap-6 mb-12">
            <div class="bg-white rounded-xl shadow-lg p-6 hover-card text-center">
                <div class="w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-4">
                    <i class="fas fa-code-branch text-2xl text-red-600"></i>
                </div>
                <h3 class="text-xl font-bold mb-2">版本冲突</h3>
                <p class="text-gray-600">多个依赖引入相同库的不同版本</p>
            </div>
            <div class="bg-white rounded-xl shadow-lg p-6 hover-card text-center">
                <div class="w-16 h-16 bg-yellow-100 rounded-full flex items-center justify-center mx-auto mb-4">
                    <i class="fas fa-download text-2xl text-yellow-600"></i>
                </div>
                <h3 class="text-xl font-bold mb-2">下载失败</h3>
                <p class="text-gray-600">网络问题或仓库配置错误</p>
            </div>
            <div class="bg-white rounded-xl shadow-lg p-6 hover-card text-center">
                <div class="w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4">
                    <i class="fas fa-tools text-2xl text-blue-600"></i>
                </div>
                <h3 class="text-xl font-bold mb-2">构建异常</h3>
                <p class="text-gray-600">代码错误或插件配置问题</p>
            </div>
        </div>
        
        <!-- 依赖关系可视化 -->
        <div class="bg-white rounded-2xl shadow-xl p-8 mb-12">
            <h3 class="text-2xl font-bold mb-6 text-center gradient-text">Maven 依赖管理核心概念</h3>
            <div class="mermaid">
                graph TD
                    A[项目 POM] --> B[直接依赖]
                    B --> C[传递性依赖]
                    C --> D[版本冲突]
                    D --> E[依赖仲裁]
                    E --> F[最短路径优先]
                    E --> G[声明顺序优先]
                    
                    H[依赖管理] --> I[dependencyManagement]
                    H --> J[exclusions]
                    H --> K[scope控制]
                    
                    L[仓库体系] --> M[本地仓库]
                    L --> N[中央仓库]
                    L --> O[私有仓库]
                    
                    style A fill:#4f46e5,stroke:#333,stroke-width:2px,color:#fff
                    style H fill:#7c3aed,stroke:#333,stroke-width:2px,color:#fff
                    style L fill:#ec4899,stroke:#333,stroke-width:2px,color:#fff
            </div>
        </div>
        
        <!-- 第一部分：版本冲突 -->
        <section class="mb-16">
            <div class="bg-white rounded-2xl shadow-xl p-8 hover-card">
                <h2 class="text-3xl font-bold mb-8 flex items-center">
                    <span class="section-number">1</span>
                    如何解决版本冲突？
                </h2>
                
                <div class="mb-8">
                    <p class="text-lg text-gray-700 mb-6">
                        依赖冲突是 Maven 项目中最常见的问题之一。当多个依赖引入了相同库的不同版本时，Maven 需要选择一个版本来使用，这可能导致运行时错误或不可预期的行为。
                    </p>
                    
                    <h3 class="text-2xl font-semibold mb-4 flex items-center">
                        <i class="fas fa-exclamation-triangle text-yellow-500 mr-3"></i>
                        依赖冲突的原因
                    </h3>
                    
                    <div class="grid md:grid-cols-3 gap-4 mb-8">
                        <div class="bg-gradient-to-br from-purple-50 to-pink-50 p-6 rounded-lg">
                            <h4 class="font-bold text-purple-700 mb-2">传递性依赖</h4>
                            <p class="text-sm text-gray-600">A 依赖 B，B 依赖 C，而 A 也直接依赖 C 的不同版本</p>
                        </div>
                        <div class="bg-gradient-to-br from-blue-50 to-cyan-50 p-6 rounded-lg">
                            <h4 class="font-bold text-blue-700 mb-2">多模块项目</h4>
                            <p class="text-sm text-gray-600">不同模块引入了相同库的不同版本</p>
                        </div>
                        <div class="bg-gradient-to-br from-green-50 to-emerald-50 p-6 rounded-lg">
                            <h4 class="font-bold text-green-700 mb-2">第三方库依赖</h4>
                            <p class="text-sm text-gray-600">第三方库可能依赖了冲突的版本</p>
                        </div>
                    </div>
                    
                    <h3 class="text-2xl font-semibold mb-4 flex items-center">
                        <i class="fas fa-search text-blue-500 mr-3"></i>
                        如何排查依赖冲突
                    </h3>
                    
                    <p class="text-gray-700 mb-4">使用 <code class="bg-gray-100 px-2 py-1 rounded">mvn dependency:tree</code> 命令可以查看项目的依赖树，快速定位冲突的依赖：</p>
                    
                    <pre data-language="bash"><code>mvn dependency:tree</code></pre>
                    
                    <p class="text-gray-700 mb-2">输出示例：</p>
                    
                    <pre data-language="plain"><code>[INFO] com.ts:ts-project:jar:1.0.0
[INFO] +- org.springframework:spring-core:jar:5.3.10:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.12.0:compile
[INFO] \- com.fasterxml.jackson.core:jackson-databind:jar:2.12.3:compile
[INFO]    \- com.fasterxml.jackson.core:jackson-core:jar:2.12.3:compile</code></pre>
                    
                    <h3 class="text-2xl font-semibold mb-4 flex items-center">
                        <i class="fas fa-wrench text-green-500 mr-3"></i>
                        解决依赖冲突的方法
                    </h3>
                    
                    <div class="space-y-6">
                        <div class="bg-gray-50 p-6 rounded-lg">
                